@import "../../../styles/animate";

.switch-wrap {
    position: relative;
    min-width: 40px;
    height: 22px;
    line-height: 23px;
    display: inline-block;
    background: #ccc;
    border-radius: 20px;
    vertical-align: middle;
    cursor: pointer;
    @include transition();

    &:after {
        position: absolute;
        width: 18px;
        height: 18px;
        left: 2px;
        top: 2px;
        border-radius: 18px;
        background: #fff;
        content: ' ';
        cursor: pointer;
        @include transition();
    }

    &:focus {
        box-shadow: 0 0 0 2px rgba(45,183,245,.2);
        outline: 0;
    }

    &:active:after {
        width: 24px;
    }

    &.switch-wrap-disabled {
        background: #ccc;
        cursor: not-allowed;

        &:after {
            background: #ccc;
            cursor: not-allowed;
        }
    }

    &.switch-wrap-checked {
        background: #55acef;

        &:after {
            left: 100%;
            margin-left: -20px;
        }

        &:active:after {
            margin-left: -26px;
        }
    }

    &.switch-wrap-sm {
        height: 14px;
        min-width: 28px;
        line-height: 12px;

        .switch-text {
            margin-left: 16px;
            margin-right: 7px;
            font-size: 11px;
        }

        &:after {
            width: 12px;
            height: 12px;
            top: 1px;
            left: 1px;
        }

        &:active:after {
            width: 16px;
        }

        &.switch-wrap-checked {
            .switch-text {
                margin-left: 7px;
                margin-right: 16px;
            }

            &:after {
                left: 100%;
                margin-left: -13px;
            }

            &:active:after {
                margin-left: -17px;
            }
        }
    }
}